﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Configuration;
using System.Runtime.Remoting.Channels;
using System.Collections;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting;
using System.Runtime.Serialization.Formatters;
using Interface_Tier;
using Business_Tier;

namespace WindowsService_HRMSS
{
    public partial class Service_eSolution_HRMSS : ServiceBase
    {
        public Service_eSolution_HRMSS()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            int soport = int.Parse(ConfigurationManager.AppSettings["port"].ToString());

            BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider();
            provider.TypeFilterLevel = TypeFilterLevel.Full;
            IDictionary Port = new Hashtable();
            Port["port"] = soport;
            TcpChannel kenh = new TcpChannel(Port, null, provider);
            ChannelServices.RegisterChannel(kenh, false);
            //khong thay lop BT_BangCap vi chua set public class
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_NhanVien), "bt_nhanvien", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HocVan), "bt_hocvan", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_CommonCode), "BT_CommonCode", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_ALLOWANCEData), "BT_DIC_ALLOWANCEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_QuocTich), "BT_QuocTich", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DanToc), "BT_DanToc", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_TonGiao), "BT_TonGiao", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_RELATIVE), "BT_DIC_RELATIVE", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_LANGUAGE), "BT_DIC_LANGUAGE", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_INFORMATIC), "BT_DIC_INFORMATIC", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_SKILL), "BT_DIC_SKILL", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_JOB), "BT_DIC_JOB", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_BangCap), "BT_BangCap", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_PROFESSIONAL), "BT_DIC_PROFESSIONAL", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_CANDIDATE_MARKData), "BT_HRM_CANDIDATE_MARKData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_CANDIDATE_RATEData), "BT_HRM_CANDIDATE_RATEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_CANDIDATEData), "BT_HRM_CANDIDATEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_CONTRACTData), "BT_HRM_CONTRACTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_DEPARTMENT_RATEData), "BT_HRM_DEPARTMENT_RATEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_DEPARTMENTData), "BT_HRM_DEPARTMENTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_EMPLOYEE_RELATIVEData), "BT_HRM_EMPLOYEE_RELATIVEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_USERData), "BT_SYS_USERData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_RULEData), "BT_SYS_RULEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_OPTIONData), "BT_SYS_OPTIONData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_OBJECTData), "BT_SYS_OBJECTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_LOGData), "BT_SYS_LOGData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_INFOData), "BT_SYS_INFOData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_GROUPData), "BT_SYS_GROUPData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_GROUP_OBJECTData), "BT_SYS_GROUP_OBJECTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SYS_COMPANYData), "BT_SYS_COMPANYData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_SOFTData), "BT_SOFTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_KEYCODEData), "BT_KEYCODEData", WellKnownObjectMode.SingleCall);
			RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_EMPLOYEE_ALLOWANCE), "BT_HRM_EMPLOYEE_ALLOWANCE", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_HOSPITAL), "BT_DIC_HOSPITAL", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_NoiDaoTao), "BT_NoiDaoTao", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_ChiNhanh), "BT_ChiNhanh", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_PhongBan), "BT_PhongBan", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_CANDIDATE_DEGREEData), "BT_HRM_CANDIDATE_DEGREEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_POSITION), "BT_DIC_POSITION", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_WORKData), "BT_HRM_WORKData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_WELFAREData), "BT_HRM_WELFAREData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_TRAININGData), "BT_HRM_TRAININGData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_TRAINING_EMPLOYEEData), "BT_HRM_TRAINING_EMPLOYEEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_TIMEKEEPERData), "BT_HRM_TIMEKEEPERData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_TIMEKEEPER_TABLELISTData), "BT_HRM_TIMEKEEPER_TABLELISTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_TIMEKEEPER_TABLEData), "BT_HRM_TIMEKEEPER_TABLEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_TIMEKEEPER_SHIFTData), "BT_HRM_TIMEKEEPER_SHIFTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_RATEData), "BT_DIC_RATEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_PROVINCEData), "BT_DIC_PROVINCEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_HOSPITALData), "BT_DIC_HOSPITALData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_HOLIDAYData), "BT_DIC_HOLIDAYData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_DISCIPLINE_EMPLOYEEData), "BT_HRM_DISCIPLINE_EMPLOYEEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_DISCIPLINEData), "BT_HRM_DISCIPLINEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_EMPLOYEE_DEGREEData), "BT_HRM_EMPLOYEE_DEGREEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_GROUP_RATEData), "BT_HRM_GROUP_RATEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_GROUPData), "BT_HRM_GROUPData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_INSURANCE_DECLARATIONData), "BT_HRM_INSURANCE_DECLARATIONData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_INSURANCE_MODIFYData), "BT_HRM_INSURANCE_MODIFYData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_INSURANCE_PROCESSData), "BT_HRM_INSURANCE_PROCESSData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_INSURANCE_TABLELISTData), "BT_HRM_INSURANCE_TABLELISTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_INSURANCEData), "BT_HRM_INSURANCEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PAYINSURANCE_C66AHDData), "BT_HRM_PAYINSURANCE_C66AHDData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PAYINSURANCE_C67AHDData), "BT_HRM_PAYINSURANCE_C67AHDData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PAYINSURANCE_C68AHDData), "BT_HRM_PAYINSURANCE_C68AHDData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PAYINSURANCE_C69AHDData), "BT_HRM_PAYINSURANCE_C69AHDData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PAYINSURANCE_TABLELISTData), "BT_HRM_PAYINSURANCE_TABLELISTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_ACCIDENTData), "BT_HRM_PROCESS_ACCIDENTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_ADVANCEData), "BT_HRM_PROCESS_ADVANCEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_ASSIGNMENTData), "BT_HRM_PROCESS_ASSIGNMENTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_DISCIPLINEData), "BT_HRM_PROCESS_DISCIPLINEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_POSITIONData), "BT_HRM_PROCESS_POSITIONData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_RATEData), "BT_HRM_PROCESS_RATEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_RATEDETAILData), "BT_HRM_PROCESS_RATEDETAILData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_REWARDData), "BT_HRM_PROCESS_REWARDData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_SALARYData), "BT_HRM_PROCESS_SALARYData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_PROCESS_TRAININGData), "BT_HRM_PROCESS_TRAININGData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_HRM_RECRUITMENTData), "BT_HRM_RECRUITMENTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_REWARD_EMPLOYEEData), "HRM_REWARD_EMPLOYEEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_REWARDData), "HRM_REWARDData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARY_ALLOWANCEData), "HRM_SALARY_ALLOWANCEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARY_BYDEPARTMENTData), "HRM_SALARY_BYDEPARTMENTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARY_MINUSData), "HRM_SALARY_MINUSData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARY_OVERTIMEData), "HRM_SALARY_OVERTIMEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARY_PLUSData), "HRM_SALARY_PLUSData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARY_TABLELISTData), "HRM_SALARY_TABLELISTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_SALARYData), "HRM_SALARYData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_TIMEKEEPER_FURLOUGHData), "HRM_TIMEKEEPER_FURLOUGHData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_TIMEKEEPER_MACHINEData), "HRM_TIMEKEEPER_MACHINEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HRM_TIMEKEEPER_OVERTIMEData), "HRM_TIMEKEEPER_OVERTIMEData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_SALARY_RANKData), "BT_DIC_SALARY_RANKData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_SALARY_STEPData), "BT_DIC_SALARY_STEPData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_MINIMUMSALARYData), "BT_DIC_MINIMUMSALARYData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_SCHOOLDATA), "BT_DIC_SCHOOLDATA", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_SHIFTData), "BT_DIC_SHIFTData", WellKnownObjectMode.SingleCall);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(BT_DIC_SYMBOLData), "BT_DIC_SYMBOLData", WellKnownObjectMode.SingleCall);
        }

        protected override void OnStop()
        {
        }
    }
}
